package week7;
import java.util.HashSet;
import java.util.Set;
import java.util.*;
public class pta02hashset {
	//package test;
		public static void main(String[] args) {
			int num=0;
			Set<String> setword =new TreeSet<>();
			Scanner sc = new Scanner(System.in );
		   while(true){
			String  word  =sc.next();
			if(word.equals("!!!!!"))
				break;
			setword.add(word);
				
		}
		   System.out.println(setword.size());
		  for(String e :setword){
			  System.out.println(e);
			  num++;
			  if(num==10)
				  break;
		   }
			
		}

		

	}



